﻿@{
    var dt = ViewData["dt"] as System.Data.DataTable;
    ViewBag.Title = "会员卡激活";
    Layout = "~/Views/Shared/_BootstrapUI.cshtml";
}
<script src="~/Scripts/ajaxfileupload.js"></script>
<div class="container">
    <form id="form" role="form" class="form-horizontal" data-parsley-validate="" novalidate="">
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>姓名</label>
                    <div class="col-md-8">
                        <input id="id" type="hidden" value="-1" />
                        <input id="name" type="text" placeholder="姓名" value="@(dt.Rows.Count >0?dt.Rows[0]["name"]:"")" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入姓名..." />
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>手机号码</label>
                    <div class="col-md-8">
                        <input id="mobile" type="text" placeholder="手机号码" value="@(dt.Rows.Count >0?dt.Rows[0]["mobile"]:"")" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入手机号码..." />
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>身份证号码</label>
                    <div class="col-md-8">
                        <input id="cardno" type="text" onkeyup="value=value.replace(/^[a-zA-Z]+\D*|^\d{0,16}[a-zA-Z]+|[^0-9Xx]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" maxlength="18" placeholder="身份证号码" value="@(dt.Rows.Count >0?dt.Rows[0]["cardno"]:"")" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入身份证号码..." />
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>性别</label>
                    <div class="col-md-8">
                        <select id="sex" type="text" placeholder="性别" value="@(dt.Rows.Count >0?dt.Rows[0]["sex"]:"")" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入性别...">
                            @if (dt.Rows.Count > 0 && dt.Rows[0]["sex"].ToString() == "1")
                            {
                                <option value="0">男</option>
                                <option value="1" selected="selected">女</option>}
                            else
                            {
                                <option value="0">男</option>
                                <option value="1">女</option>
                            }
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label">血型</label>
                    <div class="col-md-8">
                        <select id="bloodType" type="text" placeholder="血型" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入血型...">
                            @{
                                var boolType = new FZKJ.BLL.sys_dict().GetModelList(" value='bloodType'");
                                if (boolType.Count > 0)
                                {
                                    var lists1 = new FZKJ.BLL.sys_dict().GetModelList(" pid='" + boolType[0].id + "'");
                                    foreach (var item in lists1)
                                    {
                                        if (dt.Rows.Count > 0 && dt.Rows[0]["bloodType"].ToString() == item.label)
                                        {
                                            <option selected="selected" value="@item.label">@item.label</option>
                                        }
                                        else
                                        {
                                            <option value="@item.label">@item.label</option>
                                        }
                                    }
                                }
                            }
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label">病史</label>
                    <div class="col-md-8">
                        <input id="illnesshistory" type="text" placeholder="病史" value="@(dt.Rows.Count >0?dt.Rows[0]["illnesshistory"]:"")" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入病史..." />
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>紧急联系人</label>
                    <div class="col-md-8">
                        <input id="emergencycontact" type="text" placeholder="紧急联系人" value="@(dt.Rows.Count >0?dt.Rows[0]["emergencycontact"]:"")" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入紧急联系人..." />
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>紧急联系人手机号</label>
                    <div class="col-md-8">
                        <input id="emergencycontactmobile" type="text" placeholder="紧急联系人手机号" value="@(dt.Rows.Count >0?dt.Rows[0]["emergencycontactmobile"]:"")" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入紧急联系人手机号..." />
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>保险公司</label>
                    <div class="col-md-8">
                        <select id="company" name="company" type="text" class="form-control  input-sm input-sm" required="required">
                            @{
                                var blls1 = new FZKJ.BLL.sys_dict();
                                var lists13 = blls1.GetModelList(" value='insurancecompany'");
                                if (lists13.Count > 0)
                                {
                                    var lists12 = blls1.GetModelList(" pid='" + lists13[0].id + "'");
                                    foreach (var item in lists12)
                                    {
                                        if (dt.Rows.Count > 0 && dt.Rows[0]["company"].ToString() == item.id.ToString())
                                        {
                                            <option selected="selected" value="@item.id">@item.label</option>
                                        }
                                        else
                                        {
                                            <option value="@item.id">@item.label</option>
                                        }
                                    }
                                }
                            }
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>保单号</label>
                    <div class="col-md-8">
                        <input id="policynumber" type="text" placeholder="保单号" value="@(dt.Rows.Count >0?dt.Rows[0]["policynumber"]:"")" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入保单号..." />
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>车牌</label>
                    <div class="col-md-8">
                        <input id="licenseplate" type="text" placeholder="车牌" value="@(dt.Rows.Count >0?dt.Rows[0]["numberplate"]:"")" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入车牌..." />
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>车驾号</label>
                    <div class="col-md-8">
                        <input id="drivingnumber" type="text" placeholder="车驾号" class="form-control  input-sm  input-sm" value="@(dt.Rows.Count >0?dt.Rows[0]["VIN"]:"")" required="required" data-parsley-error-message="请输入车驾号..." />
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>发动机号</label>
                    <div class="col-md-8">
                        <input id="enginenumber" type="text" placeholder="发动机号" value="@(dt.Rows.Count >0?dt.Rows[0]["driving"]:"")" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入发动机号..." />
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label"><span style="color:red">*</span>保险代理公司</label>
                    <div class="col-md-8">
                        <input id="insureanceAgent" type="text" placeholder="保险代理公司：" value="@(dt.Rows.Count >0?dt.Rows[0]["insureanceAgent"]:"")" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入保险代理公司..." />
                    </div>
                </div>
            </div>
        </div>
        @if (ViewBag.action != "readonly")
        {
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="col-md-4 control-label"><span style="color:red">*</span>卡号</label>
                        <div class="col-md-8">
                            <input id="card" type="text" placeholder="卡号" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入发动机号..." />
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="col-md-4 control-label"><span style="color:red">*</span>密码</label>
                        <div class="col-md-8">
                            <input id="password" type="text" placeholder="密码：" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入发动机号..." />
                        </div>
                    </div>
                </div>
            </div>
        }
        <div class="row">

            <div class="col-md-6">
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="col-md-12 control-label">证件信息:</label>
                    </div>
                </div>
                <div class="col-md-8">
                    <input id="headerfile" hidden="hidden" />
                    <img src="@(dt.Rows.Count>0&& !string.IsNullOrWhiteSpace(dt.Rows[0]["cardpic"].ToString())?"../../Resourse/"+dt.Rows[0]["cardpic"].ToString(): "../../Content/images/u979.png")" onclick="UploadHead('header')" id="headesrc" />
                    <img src="@(dt.Rows.Count>0&& !string.IsNullOrWhiteSpace(dt.Rows[0]["option1"].ToString())?"../../Resourse/"+dt.Rows[0]["option1"].ToString(): "../../Content/images/u979.png")" id="handsrc" onclick="UploadHead('hands')" />
                    <input id="handfile" hidden="hidden" />
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label">备注</label>
                    <div class="col-md-8">
                        <input id="remark" name="remark" type="text" placeholder="备注" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入备注..." />
                    </div>
                </div>
            </div>
        </div>
        @if (ViewBag.action == "readonly")
        {
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="col-md-4 control-label">卡号状态：</label>
                        <div class="col-md-8">
                            <h3>已激活</h3>
                        </div>
                    </div>
                </div>
            </div>
            <script>
                $("#form input").attr("readOnly", "true");
            </script>
        }
    </form>

    @if (ViewBag.action != "readonly")
    {<div style="float:right">
            <button id="btnSpecialPolicySave" type="button" class="btn btn-primary">激活</button>
        </div>
    }
</div>
<input type="file" style="display:none" id="header" name="header" onchange="UploadCard('header', 'headerfile', 'headesrc')" />
<input type="file" style="display:none" id="hands" name="hands" onchange="UploadCard('hands', 'handfile', 'handsrc')" />
<script src="~/Pscripts/RescueCard/ActivationManage.js?v=@DateTime.Now.ToString("yyyyMMddHHmmssfff")"></script>